﻿@inherits OperationDialogBase<OperationDialogInput<Guid>, OperationDialogOutput<Guid>, EmailLocalResource>

<Form Loading="@_isLoading"
      Model="@_sendEmailInput"
      LabelCol="new ColLayoutParam { Span = 8 }"
      WrapperCol="new ColLayoutParam { Span = 16 }"
      OnFinish="OnFormFinish"
      Context="model">
    <FormItem Label="@base.Localizer[EmailLocalResource.TemplateId]">
        <Input Disabled="true" @bind-Value="@model.TemplateId" />
    </FormItem>
    <FormItem Label="@base.Localizer[EmailLocalResource.ToEmail]">
        <Input @bind-Value="@model.ToEmail" />
    </FormItem>
    <FormItem Label="@base.Localizer[EmailLocalResource.Data]">
        <TextArea AutoSize="true" MinRows="2" MaxRows="6" @bind-Value="@_emailData"></TextArea>
    </FormItem>
    <FormItem Label="@base.Localizer[EmailLocalResource.EmailServerConfig]">
        <Select DataSource="@emailServerConfigs"
                @bind-Value="@model.EmailServerConfigId"
                ValueName="@nameof(EmailServerConfigDto.Id)"
                LabelName="@nameof(EmailServerConfigDto.Name)">
        </Select>
    </FormItem>

    <FormItem WrapperColOffset="8" WrapperColSpan="16">
        <Space>
            <SpaceItem>
                <Button Type="@ButtonType.Primary" HtmlType="submit">
                    @Localizer[SharedLocalResource.Send]
                </Button>
            </SpaceItem>
            <SpaceItem>
                <Button OnClick="_=>OnFormCancel()">
                    @Localizer[SharedLocalResource.Cancel]
                </Button>
            </SpaceItem>
        </Space>
    </FormItem>
</Form>